import Vue from 'vue'
import VueRouter from 'vue-router'
// 引入路由所对应的组件
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
import Welcome from '../views/welcome.vue'
import Users from '../views/index.vue'
import rightList from '../views/right/rightList.vue'
import roleList from '../views/right/roleList.vue'

Vue.use(VueRouter)
// 创建路由对象
var router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: { name: 'home' }
    },
    {
      name: 'login',
      path: '/login',
      component: Login
    },
    {
      name: 'home',
      path: '/home',
      component: Home,
      //   path:'/',
      redirect: { path: '/home/welcome' },
      children: [
        {
          name: 'welcome',
          path: 'welcome',
          component: Welcome
        },
        {
          name: 'users',
          path: 'users',
          component: Users
        },
        {
          name: 'rightList',
          path: 'rightList',
          component: rightList
        },
        {
          name: 'roleList',
          path: 'roleList',
          component: roleList
        }
      ]
    }
  ]
})
// 暴露路由对象
export default router
